#!/usr/bin/bash

BC_CORE_NAME=bc
BC_FC_SRV_NAME=fc_srv

./debug/$BC_CORE_NAME &
BC_CORE_PID=$!

./build/$BC_FC_SRV_NAME &
BC_FC_SRV_PID=$!

echo $BC_CORE_PID
echo $BC_FC_SRV_PID

waitpid -c 1 $BC_CORE_PID $BC_FC_SRV_PID

if [ "$(ps -p $BC_CORE_PID -o comm --no-headers)" == $BC_CORE_NAME ] 
then
  kill $BC_CORE_PID
fi

if [ "$(ps -p $BC_FC_SRV_PID -o comm --no-headers)" == $BC_FC_SRV_NAME ] 
then
  kill $BC_FC_SRV_PID
fi
